home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / winsock / wschesb1.zip / SRC / PROMOTE.C < prev    next >
C/C++ Source or Header  |  1994-03-15  |  3KB  |  107 lines

  1. /*
  2.   C source for Winsock Chess
  3.   
  4.   Revision 1994-03-15
  5.   Modified by Donald Munro for use as a 2 player chess game over a 
  6.   WINSOCK layer on a TCP (or other WinSock supporting) network.
  7.   Source code and make files for MS Visual C/C++ V1.00/1.50.
  8.   February/March 1994
  9.   All GNU copyright and distribution conditions as described below and in the
  10.   file COPYING also apply to WinSock Chess.
  11.   This module is adapted from GNU Chess.
  12.  
  13.   C source for GNU CHESS
  14.  
  15.   Revision: 1990-09-30
  16.  
  17.   Modified by Daryl Baker for use in MS WINDOWS environment
  18.  
  19.   This file is part of CHESS.
  20.  
  21.   CHESS is distributed in the hope that it will be useful, but WITHOUT ANY
  22.   WARRANTY.  No author or distributor accepts responsibility to anyone for
  23.   the consequences of using it or for whether it serves any particular
  24.   purpose or works at all, unless he says so in writing.  Refer to the CHESS
  25.   General Public License for full details.
  26.  
  27.   Everyone is granted permission to copy, modify and redistribute CHESS, but
  28.   only under the conditions described in the CHESS General Public License.
  29.   A copy of this license is supposed to have been given to you along with
  30.   CHESS so you can know your rights and responsibilities.  It should be in a
  31.   file named COPYING.  Among other things, the copyright notice and this
  32.   notice must be preserved on all copies.
  33. */
  34.  
  35. #define NOATOM 
  36. #define NOCLIPBOARD
  37. #define NOCREATESTRUCT
  38. #define NOFONT
  39. #define NOREGION
  40. #define NOSOUND
  41. #define NOWH
  42. #define NOWINOFFSETS
  43. #define NOCOMM
  44. #define NOKANJI
  45.  
  46. #include <windows.h>
  47. #include "chess.h"
  48.  
  49. BOOL FAR PASCAL PromoteDlgProc ( HWND hDlg, unsigned message,
  50.                                WORD wParam, LONG lParam);
  51.  
  52.  
  53. int PromoteDialog ( HWND hWnd, HANDLE hInst)
  54. {
  55.    FARPROC lpProcPromote;
  56.    int status;
  57.  
  58.    lpProcPromote = MakeProcInstance(PromoteDlgProc, hInst);
  59.     status = DialogBox(hInst, MAKEINTRESOURCE(PAWNPROMOTE),   hWnd,  lpProcPromote);
  60.    FreeProcInstance(lpProcPromote);
  61.    return status;
  62. }
  63.  
  64. static int xstatus;
  65.  
  66. BOOL FAR PASCAL PromoteDlgProc ( HWND hDlg, unsigned message,
  67.                                WORD wParam, LONG lParam)
  68. {
  69.  
  70.    switch (message) {
  71.        case WM_INITDIALOG:         /* message: initialize dialog box */
  72.          xstatus = 5;
  73.          CheckRadioButton ( hDlg, 100, 103, 103);
  74.          return (TRUE);
  75.  
  76.       case WM_SYSCOMMAND:
  77.          if ( (wParam&0xfff0) == SC_CLOSE ) {
  78.               EndDialog(hDlg, xstatus);
  79.               return xstatus;
  80.          }
  81.          break;
  82.  
  83.  
  84.        case WM_COMMAND:           /* message: received a command */
  85.          switch (wParam) {
  86.  
  87.             case IDOK:
  88.                EndDialog ( hDlg, xstatus);
  89.                return TRUE;
  90.          
  91.             case 100:
  92.             case 101:
  93.             case 102:
  94.             case 103:
  95.                   xstatus = 2+wParam-100;
  96.                   CheckRadioButton ( hDlg, 100, 103, wParam);
  97.                   break;
  98.  
  99.          }
  100.           break;
  101.     }
  102.  
  103.     return (FALSE);               /* Didn't process a message    */
  104. }
  105.  
  106.  
  107.